<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div style="width: 100px;height: 100px;background-color: darkcyan; position: absolute;" id="div1"></div>
    <script src="jquery-1.12.2.min.js"></script>
    <script>
        $(function(){
            $(window).on("resize", function(){
                 $("#div1").css({left: ($(window).width() - $("#div1").outerWidth())/ 2, top: ($(window).height() - $("#div1").outerHeight())/ 2})
            }).trigger("resize");
        });
    </script>
</body>
</html>